




C++ Tutorial


C++ tutorial provides basic and advanced concepts of C++. Our C++ tutorial is designed for beginners and professionals.
C++ is an object-oriented programming language. It is an extension to C programming.
Our C++ tutorial includes all topics of C++ such as first example, control statements, objects and classes, inheritance, constructor, destructor, this, static, polymorphism, abstraction, abstract class, interface, namespace, encapsulation,  arrays, strings, exception handling,  File IO, etc.
 What is C++
C++ is a general purpose, case-sensitive, free-form programming language that supports object-oriented, procedural and generic programming.
C++ is a middle-level language, as it encapsulates both high and low level language features.

Object-Oriented Programming (OOPs)
C++ supports the object-oriented programming, the four major pillar of object oriented programming used in C++ are:

Inheritance
Polymorphism
Encapsulation
Abstraction


C++ Standard Libraries
Standard C++ programming is divided into three important parts:

The core library includes the data types, variables and literals, etc.
The standard library includes the set of functions manipulating strings, files, etc.
The Standard Template Library (STL) includes the set of methods manipulating a data structure.






Usage of C++
By the help of C++ programming language, we can develop different types of secured and robust applications:

Window application
Client-Server application
Device drivers
Embedded firmware etc

C++ Program
In this tutorial, all C++ programs are given with C++ compiler so that you can easily change the C++ program code.
File: main.cpp

#include 
using namespace std;
int main() {
   cout << "Hello C++ Programming";
   return 0;
}

A detailed explanation of first C++ program is given in next chapters.


C++ Index



C++ Tutorial

C++ Tutorial
What is C++
C vs C++
C++ History
C++ Features
C++ Installation 
C++ Program
C++ cout, cin, endl
C++ Variable
C++ Data types
C++ Keywords
C++ Operators

C++ Control Statement

C++ if-else
C++ switch
C++ For Loop
C++ While Loop
C++ Do-While Loop
C++ Break Statement
C++ Continue Statement
C++ Goto Statement
C++ Comments

C++ Functions

C++ Functions
Call by value & reference
C++ Recursion
C++ Storage Classes

C++ Arrays

C++ Arrays
C++  Array to Function
Multidimensional Arrays

C++ Pointers

C++ Pointers

C++ Object Class

C++ OOPs Concepts
C++ Object Class
C++ Constructor
C++ Destructor
C++ this Pointer
C++ static
C++ Structs
C++ Enumeration
C++ Friend Function

C++ Inheritance

C++ Inheritance
C++ Aggregation

C++ Polymorphism

C++ Polymorphism
C++ Overloading
C++ Overriding
C++ Virtual Function

C++ Abstraction

C++ Interfaces
C++ Data Abstraction

C++ Namespaces

C++ Namespaces

C++ Templates

C++ Templates

C++ Strings

C++ Strings

C++ Exceptions

C++ Exception Handling
C++ try/catch
C++ User-Defined

C++ File & Stream

C++ File & Stream

C++ Programs

C++Programs
Fibonacci Series
Prime Number
Palindrome Number
Factorial
Armstrong Number
Sum of digits
Reverse Number
Swap Number
Matrix Multiplication
Decimal to Binary
Number in Characters
Alphabet Triangle
Number Triangle
Fibonacci Triangle

C++ STL Tutorial

C++ STL Algorithm
algorithm adjacent_find() function
algorithm any_of() function
algorithm copy() function
algorithm copy_if() function
algorithm count() function
algorithm count_if() function
algorithm equal() function
algorithm find() function
algorithm find_end() function
algorithm find_first_of() function
algorithm find_if() function
algorithm find_if_not() function
algorithm for_each() function
algorithm move() function
algorithm all_of() function
algorithm copy_backward() function
algorithm copy_n() function
algorithm search() function
algorithm is_permutation() function
algorithm mismatch() function
algorithm move_backward() function
algorithm none_of() function
algorithm search_n() function
algorithm swap() function
algorithm fill() function
algorithm iter_swap() function
algorithm replace_copy_if() function
algorithm replace_copy() function
algorithm replace_if() function
algorithm replace() function
algorithm swap_ranges() function
algorithm transform() function
algorithm fill_n() function
algorithm generate_n() function
algorithm generate() function
algorithm remove() function
algorithm is_partitioned() function
algorithm random_shuffle() function
algorithm remove_copy_if() function
algorithm remove_copy() function
algorithm partition_copy() function
algorithm partition_point() function
algorithm partition() function
algorithm remove_if() function
algorithm reverse_copy() function
algorithm reverse() function
algorithm rotate_copy() function
algorithm rotate() function
algorithm shuffle() function
algorithm stable_partition() function
algorithm unique_copy() function
algorithm unique() function
algorithm is_sorted_until() function
algorithm is_sorted() function
algorithm lower_bound() function
algorithm nth_element() function
algorithm partial_sort_copy() function
algorithm partial_sort() function
algorithm sort() function
algorithm stable_sort() function
algorithm binary_search() function
algorithm equal_range() function
algorithm includes() function
algorithm inplace_merge() function
algorithm merge() function
algorithm set_union() function
algorithm upper_bound() function

C++ STL Bitset

C++ Bitset
bitset all() function
bitset any() function
bitset count() function
bitset flip() function
bitset none() function
bitset operator[]
bitset reset() function
bitset set() function
bitset size() function
bitset test() function
bitset to_string() function
bitset to_ullong() function
bitset to_ulong() function



C++ STL Deque

C++ Deque
Deque assign() function
Deque emplace() function
Deque emplace_back() function
Deque emplace_front() function
Deque insert() function
Deque push_back() function
Deque push_front() function
Deque pop_back() function
Deque pop_front() function
Deque swap() function
Deque clear() function
Deque empty() function
Deque erase() function
Deque max_size() function
Deque resize() function
Deque shrink_to_fit() function
Deque size() function
Deque at() function
Deque operator[]() function
Deque operator=() function
Deque back() function
Deque begin() function
Deque cbegin() function
Deque end() function
Deque cend() function
Deque rbegin() function
Deque crbegin() function
Deque rend() function
Deque crend() function

C++ STL List

C++ List
List insert() function
List push_back() function
List push_front() function
List pop_back() function
List pop_front() function
List empty() function
List size() function
List max_size() function
List front() function
List back() function
List swap() function
List reverse() function
List sort() function
List merge() function
List splice() function
List unique() function
List resize() function
List assign() function
List emplace() function
List emplace_back() function
List emplace_front() function

C++ STL Map

C++ Map
map at() function
map begin() function
map cbegin() function
map cend() function
map crbegin() function
map crend() function
map empty() function
map end() function
map max_size() function
map operator[]
map rbegin() function
map rend() function
map size() function
map clear() function
map emplace() function
map emplace_hint() function
map erase() function
map find() function
map insert() function
map operator=()
map swap() function

C++ STL Math

math cos() function
math sin() function
math tan() function
math acos() function
math asin() function
math atan() function
math atan2() function
math cosh() function
math sinh() function
math tanh() function
math acosh() function
math asinh() function
math atanh() function
math exp() function
math frexp() function
math Idexp() function
math log() function
math log10() function
math modf() function
math exp2() function
math expm1() function
math log1p() function
math log2() function
math logb() function
math scalbn() function
math scalbln() function
math ilogb() function
math copysign() function
math nextafter() function
math nexttoward() function
math fdim() function
math fmax() function
math fmin() function
math pow() function
math sqrt() function
math cbrt() function
math hypot() function
math ceil() function
math floor() function
math round() function
math lround() function
math llround() function
math fmod() function
math trunc() function
math rint() function
math lrint() function
math llrint() function
math nearbyint() function
math remainder() function
math remquo() function
math fabs() function
math abs() function
math fma() function
math fpclassify() function
math isfinite() function
math isinf() function
math isnan() function
math isnormal() function
math signbit() function
math isgreater() function
math isgreaterequal() function
math less() function
math islessequal() function
math islessgreater() function
math isunordered() function
math erf() function
math erfc() function
math tgamma() function
math lgamma() function

C++ STL priority_queue

C++ priority_queue
priority_queue emplace() function
priority_queue empty() function
priority_queue pop() function
priority_queue push() function
priority_queue size() function
priority_queue swap() function
priority_queue top() function

C++ STL Stack

C++ Stack
stack emplace() function
stack empty() function
stack pop() function
stack push() function
stack size() function
stack top() function

C++ STL Queue

C++ Queue
queue back() function
queue emplace() function
queue empty() function
queue front() function
queue pop() function
queue push() function
queue size() function



C++ STL Multiset

C++ multiset
multiset constructor
multiset destructor
multiset begin() function
multiset end() function
multiset operator=
multiset rbegin() function
multiset rend() function
multiset cbegin() function
multiset cend() function
multiset max_size() function
multiset size() function
multiset crbegin() function
multiset crend() function
multiset empty() function
multiset insert() function
multiset clear() function
multiset emplace() function
multiset erase() function
multiset swap() function
multiset emplace_hint() function
multiset find() function
multiset key_comp() function
multiset value_comp() function
multiset count() function
multiset equal_range() function
multiset lower_bound() function
multiset upper_bound() function
multiset get_allocator() function
multiset operator==
multiset operator!=
multiset operator<
multiset operator<=
multiset operator>
multiset operator>=
multiset swap() function

C++ STL Multimap

C++ Multimap
multimap crbegin() function
multimap crend() function
multimap begin() function
multimap cbegin() function
multimap cend() function
multimap end() function
multimap rbegin() function
multimap rend() function
multimap clear() function
multimap emplace() function
multimap empty() function
multimap erase() function
multimap insert() function
multimap swap() function
multimap equal_range() function
multimap operator==
multimap operator!=
multimap operator<
multimap operator<=
multimap operator>
multimap operator>=
multimap swap() function

C++ STL Set

C++ Set
set constructor
set destructor
set operator=() function
set begin() function
set cbegin() function
set end() function
set cend() function
set rbegin() function
set rend() function
set crbegin() function
set crend() function
set empty() function
set Size() function
set max_size() function
set insert() function
set erase() function
set Swap() function
set clear() function
set emplace() function
set emplace_hint() function
set key_comp() function
set value_comp() function
set find() function
set count() function
set lower_bound() function
set upper_bound() function
set equal_range() function
set get_allocator() function
set operator==
set operator!=
set operator<
set operator<=
set operator>
set operator>=
set swap() function

C++ STD Strings

string compare() function
string length() function
string swap() function
string substr() function
string size() function
string resize() function
string replace() function
string append() function
string at() function
string find() function
string find_first_of() function
string find_first_not_of() function
string find_last_of() function
string find_last_not_of() function
string insert() function
string max_size() function
string push_back() function
string pop_back() function
sstring assign() function
string copy() function
string back() function
string begin() function
string capacity() function
string cbegin() function
string cend() function
string clear() function
string crbegin() function
string data() function
string empty() function
string erase() function
string front() function
string operator+=()
string operator=()
string operator[]()
string rfind() function
string end() function
string rend() function
string shrink_to_fit() function
string c_str() function
string crend() function
string rbegin() function
string reserve() function
string get_allocator() function

C++ STL Vector

C++ Vector
Vector at() function
Vector back() function
Vector front() function
Vector swap() function
Vector push_back() function
Vector pop_back() function
Vector empty() function
Vector insert() function
Vector erase() function
Vector resize() function
Vector clear() function
Vector size() function
Vector capacity() function
Vector assign() function
Vector operator=() function
Vector operator[]() function
Vector end() function
Vector emplace() function
Vector emplace_back() function
Vector rend() function
Vector rbegin() function
Vector begin() function
Vector max_size() function
Vector cend() function
Vector cbegin() function
Vector crbegin() function
Vector crend() function
Vector data() function
Vector shrink_to_fit() function

Interview Questions

Interview Questions




Prerequisite
Before learning C++, you must have the basic knowledge of C.
Audience
Our C++ tutorial is designed to help beginners and professionals.
Problem
We assure that you will not find any problem in this C++ tutorial. But if there is any mistake, please post the problem in contact form.












Please Share





